var _imgObj = null;
function method() {
  var imgPath = sessionStorage.getItem('currImgPath');
  console.log('imgPath: ', imgPath);
  if(imgPath.indexOf('file') == -1){ 
    $('.imgYT').hide();
  } else {
    $('.imgGQ').hide();
  }
  _imgObj = $('#zoom-marker-img').zoomMarker({
    src: imgPath,
    rate: 0.2, 
    width: '100%',
    /*max: 3000,*/
    // left: 'calc(50% - 464px)',
    markers:[],
    enable_canvas: true
  });
  
}
// 监听图片资源加载结束消息，更新UI资源。
$('#zoom-marker-img').on("zoom_marker_img_loaded", function(event, size){
  // console.log("image has been loaded with size: "+JSON.stringify(size));
  /** 更新UI操作 **/
  $('#zoom-marker-img').height('100%');

});

// 图片级别切换
function imglevelJS() {
  var imgPath = $('#picOriginalPath').val();
  sessionStorage.setItem('currImgPath', baseurl+imgPath);
  window.location.reload();
}
function imglevelGQ() {
  var imgPath = $('#picPath').val();
  sessionStorage.setItem('currImgPath', imageURL+imgPath);
  window.location.reload();
}

// 鼠标右键事件
window.addEventListener('mousedown', onMouseDown, false);
var mouseRight = false;
function onMouseDown(event){
  if(event.button == 2){
    mouseRight = true;
    // console.log("鼠标右键!");
  }
}

/**
 * 全屏
 */
function fullScreen(){
  $('.fullscreen').hide();
  $('.fullscreen_exit').show();
  var el = document.documentElement;
  var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;      
  if(typeof rfs != "undefined" && rfs) {
     rfs.call(el);
  };
  return;
}
//退出全屏
function exitScreen(){
  $('.fullscreen').show();
  $('.fullscreen_exit').hide();
  if (document.exitFullscreen) {  
      document.exitFullscreen();  
  }  
  else if (document.mozCancelFullScreen) {  
      document.mozCancelFullScreen();  
  }  
  else if (document.webkitCancelFullScreen) {  
      document.webkitCancelFullScreen();  
  }  
  else if (document.msExitFullscreen) {  
      document.msExitFullscreen();  
  } 
  if(typeof cfs != "undefined" && cfs) {
      cfs.call(el);
  }
}
//图片放大
function zoomIn(){
  $('#zoom-marker-img').zoomMarker_Zoom(null,1.2);
}
//图片缩小
function zoomOut(){
  $('#zoom-marker-img').zoomMarker_Zoom(null,0.8);
}

window.onload = function() {
  var el = document.getElementById("zoom-marker-img");
  el.oncontextmenu = function(e) {
    if(e.button==2){
      e.preventDefault();
      //console.log("鼠标右键!");
    }
  }
};